package com.eneat.smartrule.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 布尔逻辑枚举
 */
@Getter
@AllArgsConstructor
public enum LogicEnum {
    AND("&&", "并且"),
    NOT("!", "非"),
    OR("||", "或者");

    private final String code;
    private final String desc;

    public static LogicEnum fromCode(String code) {
        for (LogicEnum logic : values()) {
            if (logic.getCode().equals(code)) {
                return logic;
            }
        }
        throw new IllegalArgumentException("未知的逻辑操作符: " + code);
    }
}
